import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/10 16:03
 * @description 差分数组
 */
public class Solution2 {
    public static void main(String[] args) {

    }
    public int minNumberOperations(int[] target) {
        int n = target.length;
        int ans = target[0];
        for (int i = 1; i < n; ++i) {
            ans += Math.max(target[i] - target[i - 1], 0);
        }
        return ans;
    }
}
